package monitor

import (
	"flag"
	"fmt"
	"log"
	"net/http"
	"time"
)

var (
	MONITOR_PORT = flag.Uint("MONITOR_PORT", 4455, "")
)

func Init() {
	go func() {
		log.Printf("monitor port: %d", *MONITOR_PORT)

		serv := &http.Server{
			Addr:         fmt.Sprintf(":%d", *MONITOR_PORT),
			ReadTimeout:  3 * time.Second,
			WriteTimeout: 3 * time.Second,
		}

		if err := serv.ListenAndServe(); nil != err {
			log.Fatal(err)
		}
	}()
}
